package com.fy.oa.zc.groovy.manager;

import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;

import com.seeyon.ctp.common.AppContext;

public class TripDailyRecordManager {
	private static JdbcTemplate jdbcTemplate = (JdbcTemplate) AppContext.getBean("fy_oa_jdbcTemplate");
	public static String getTripNum(Object object) {
		try {
			Object[] o = (Object[]) object;
			String date = (String) o[1];
			if (date != null && !"".equals(date)) {
				date = date.substring(0, 10);
				Map<String, Object> result = jdbcTemplate.queryForMap(
						"select f.tripnum tripnum from fy_oa_trip_simple_info f where f.membercode=? and f.startDate <= to_date(?,'yyyy-mm-dd') and f.endDate >= to_date(?,'yyyy-mm-dd')",
						new Object[] { o[0], date, date });
				return (String) result.get("TRIPNUM");
			}
		} catch (Exception e) {
		}
		return "";
	}

}
